package base.Day03;

public class OperationDemo3
{
    public static void main(String[] args)
    {
        OperationDemo3 operationDemo3 = new OperationDemo3();
        operationDemo3.andTest();
        operationDemo3.seasonTest();
        operationDemo3.LogicTest();
    }

    public void andTest()
    {
        int age = 10;
        System.out.println( age >= 18 && age <= 40  );
        int score = 22;
        System.out.println( score >= 60 && score <= 100 );
        int stars = 30;
        System.out.println( stars > 0 && stars < 50);
        if(stars > 0 && stars < 50)
        {
            System.out.println("王者段位");
        }
    }

    public  void LogicTest()
    {
        /**
            <p>逻辑与  逻辑或 存在短路现象   短路的解释   对于逻辑与  只要能判断出结果，出现一个false，即可判断为false 后面的就不执行
         对于逻辑或，只要有一个结果为true，则后面的就不执行
         如何使用不短路的逻辑与、或    | 和  &  不短路  也可以表示位与 位或</p>

        */
        int a = 5;
        int b = 10;
        int c = 5;
        // a++ 被短路
        boolean t1 = a > b && a++>10;
        System.out.println(t1);
        System.out.println(a);

    }


    // Enum测试
    public void seasonTest()
    {
        Season currentSeason = Season.WINTER;
        // 遍历
        for (Season s: Season.values())
        {
            System.out.println(s.getDescription());
        }
        System.out.println(currentSeason+"     "+currentSeason.getDescription());

        // 如何比较
        if(currentSeason == Season.AUTUMN)
        {
            System.out.println("It is cool");
        }
        else
        {
            System.out.println("oh  it is bad");
        }
    }

}
